CsvEntityList
交易对象列表,收自CSV存储器.
继承自: SynchronizedList<T>
实现: IStorageEntityList<T>, INotifyList<T>, INotifyCollection<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList<T>, ISynchronizedCollection<T>, ISynchronizedCollection, ISynchronizable, ICsvEntityList, IAsyncDisposable
构造函数
protected CsvEntityList(CsvEntityRegistry registry, string fileName, ChannelExecutor executor)
csvEntityList = CsvEntityList(registry, fileName, executor)
初始化了 & ##CsvEntityList+#的新实例.
- registry
- 交易对象的 CSV 存储器 。
- fileName
- CSV文件名.
- executor
- 磁盘访问同步的序列操作执行器 。
属性
public bool CreateArchivedCopy { get; set; }
value = csvEntityList.CreateArchivedCopy
csvEntityList.CreateArchivedCopy = value
创建存档副本.
protected CsvEntityRegistry Registry { get; }
value = csvEntityList.Registry
交易对象的 CSV 存储器 。
方法
protected virtual void AddCache(TEntity item)
csvEntityList.AddCache(item)
添加项目到缓存 。
- item
- 新项目。
private Encoding AppendEncoding()
result = csvEntityList.AppendEncoding()
The encoding an append is written in.
返回值: The registry's encoding, without its preamble when the file already carries one.
public override bool Contains(TEntity item)
result = csvEntityList.Contains(item)
Determines whether the collection contains a specific item.
- item
- The item to locate.
返回值: true if the item is found; otherwise, false.
public ValueTask<byte[]> GetCopyAsync(CancellationToken cancellationToken)
result = csvEntityList.GetCopyAsync(cancellationToken)
Get archived copy body.
- cancellationToken
- Cancellation token.
返回值: File body.
protected abstract TKey GetKey(TEntity item)
result = csvEntityList.GetKey(item)
从交易对象那里取出密钥.
- item
- 贸易对象.
返回值: 钥匙
protected virtual bool IsChanged(TEntity entity, bool forced)
result = csvEntityList.IsChanged(entity, forced)
已经换了
- entity
- 贸易对象.
- forced
- 强制更新.
返回值: 已经换了
protected override void OnCleared()
csvEntityList.OnCleared()
Invokes the Cleared event and notifies of a change after clearing the collection.
protected void OnRemovedRange(IEnumerable<TEntity> items)
csvEntityList.OnRemovedRange(items)
protected abstract ValueTask<TEntity> ReadAsync(FastCsvReader reader, CancellationToken cancellationToken)
result = csvEntityList.ReadAsync(reader, cancellationToken)
Read data from CSV.
- reader
- CSV reader.
- cancellationToken
- CancellationToken
返回值: Trade object.
protected virtual void RemoveCache(TEntity item)
csvEntityList.RemoveCache(item)
从缓存中移除项目 。
- item
- 项目。
public virtual void Save(TEntity entity, bool forced)
csvEntityList.Save(entity, forced)
将对象保存到存储中 。
- entity
- 贸易对象.
- forced
- 强制更新.
protected virtual void UpdateCache(TEntity item)
csvEntityList.UpdateCache(item)
更新缓存中的项目 。
- item
- 项目。
protected abstract ValueTask WriteAsync(CsvFileWriter writer, TEntity data, CancellationToken cancellationToken)
result = csvEntityList.WriteAsync(writer, data, cancellationToken)
将数据写入 CSV.
- writer
- CSV作家.
- data
- 贸易对象.
- cancellationToken
- CancellationToken
private void WriteMany(TEntity[] values)
csvEntityList.WriteMany(values)
将数据写入存储中 。
- values
- 交易对象.